
# 启用自动生成qt源码
macro(QT_CMAKE_AUTO)
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
endmacro(QT_CMAKE_AUTO)


# 采集源代码
macro (QT_COLLECT_COMPLIE_SOURCE in_soruce_root_dir out_source_file_list)
    file(GLOB ${out_source_file_list}
        ${in_soruce_root_dir}/*.ui
    )
endmacro (QT_COLLECT_COMPLIE_SOURCE)

# 遍历采集源代码
macro (QT_COLLECT_COMPLIE_SOURCE in_soruce_root_dir out_source_file_list)
    file(GLOB_RECURSE ${out_source_file_list}
        ${in_soruce_root_dir}/*.ui
    )
endmacro (QT_COLLECT_COMPLIE_SOURCE)

# 采集源代码，并根据目录分组
macro(qt_all_source CC_SOURCES)
    QT_CMAKE_AUTO()
    QT_COLLECT_COMPLIE_SOURCE(${CMAKE_CURRENT_LIST_DIR} cc_complie_sources) 
    CC_SOURCE_GROUP_BY_DIR(cc_complie_sources)
    list(APPEND ${CC_SOURCES} ${cc_complie_sources})    
endmacro(qt_all_source)

# 遍历采集源代码，并根据目录分组
macro(qt_all_source_recurse CC_SOURCES)
    QT_CMAKE_AUTO()
    QT_COLLECT_COMPLIE_SOURCE(${CMAKE_CURRENT_LIST_DIR} cc_complie_sources)
    CC_SOURCE_GROUP_BY_DIR(cc_complie_sources)
    list(APPEND ${CC_SOURCES} ${cc_complie_sources})    
endmacro(qt_all_source_recurse)
